<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateSystemMenusTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('system_menus', function (Blueprint $table) {
            $table->id()->comment('菜单表');
            $table->integer('pid')->comment('父级id');
            $table->string('icon',16)->comment('图标');
            $table->string('menu_name',32)->comment('按钮名');
            $table->string('module',32)->comment('模块名');
            $table->string('controller',64)->comment('控制器');
            $table->string('action',32)->comment('方法名');
            $table->string('api_url',100)->comment('api接口地址');
            $table->string('methods',10)->comment('提交方式 (POST GET PUT DELETE)');
            $table->string('params',128)->comment('参数');
            $table->integer('sort')->default(0)->comment('排序');
            $table->string('menu_path',128)->comment('路由名称 前端使用');
            $table->string('path')->comment('路径');
            $table->string('header',50)->comment('顶级菜单标示');
            $table->string('unique_auth',150)->comment('前台唯一标识');
            $table->tinyInteger('access')->default(1)->comment('子管理员是否可用 0不可用 1可用');
            $table->tinyInteger('is_show')->default(1)->comment('是否为隐藏菜单 0=隐藏菜单 1=显示菜单');
            $table->tinyInteger('is_show_path')->default(0)->comment('是否为隐藏菜单供前台使用 0=隐藏 1=显示');
            $table->tinyInteger('is_header')->default(1)->comment('是否是顶级菜单 0否 1是');
            $table->tinyInteger('is_menu')->default(1)->comment('是否为菜单 0否 1是');
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('system_menus');
    }
}
